﻿using System.Threading;
using l1cs.server.model.Instance;
using l1cs.server.serverpackets;

namespace l1cs.server.model
{
    class L1PcDeleteTimer
    {
        private static Logger _log = Logger.getLogger( typeof( L1PcDeleteTimer ).FullName );

        Timer timer;

        private L1PcInstance _pc;

        public L1PcDeleteTimer( L1PcInstance pc )
        {
            _pc = pc;
        }

        public void run( object state )
        {
            _pc.sendPackets( new S_Disconnect() );
            timer.Dispose();
        }

        public void begin()
        {
            timer = new Timer( new TimerCallback( run ), null, 10 * 60 * 1000, 1000 );
            //timer.schedule( this, 10 * 60 * 1000 );
        }
        public void cancel()
        {
            timer.Dispose();
        }
    }
}
